/**
 * 
 */
package com.fox.webapp.service;

import java.io.IOException;
import java.io.OutputStream;
import java.util.List;

import javax.servlet.ServletOutputStream;

import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;

import com.fox.webapp.domain.Account;
import com.fox.webapp.domain.Bank;
import com.fox.webapp.domain.CommissionRecord;
import com.fox.webapp.domain.Communicate;
import com.fox.webapp.domain.Person;
import com.fox.webapp.domain.SiteMessage;
import com.fox.webapp.domain.WithdrawRecord;

/**
 * @author yockii
 *
 */
public interface IPersonService {

	boolean isExist(Person person);

	Person addNewPerson(Person person);

	Person login(String username, String password, String ip, boolean isAutoLogin);

	Person getPersonById(ObjectId userId);

	Person modifySimpleInfo(Person person);

	Person modifyPassword(Person p);

	boolean updatePersonBank(Person p, Bank bank);

	Person verifyEmail(String username, String emailUUid);
	
	Person unVerifyEmail(String username, String uuid);

	Page<Person> getPersonWithCondition(Person person, int page, int length);

	int countPersonNumWithCondition(Person person);

	Person updatePersonLoginIp(Person p);

	Page<Person> getMyReferences(Person me, int page, int length);
	
	boolean withdraw(Person p, double withdraw, String ip);
	
	int countWithdrawRecordNum(Person p);
	
	Page<WithdrawRecord> getMyWithdrawRecords(Person p, int page, int length);

	Page<CommissionRecord> findMyCommissionRecord(Person p, int page, int length);

	Person modifyQA(Person p);
	
	boolean addNewCommunicate(Communicate communicate);

	String getSecurityQuestion(String username);

	String canResetMyPassword(String username, String answer);

	boolean isPersonResetPasswordAvailable(String username, String resetUUid);

	boolean doResetPassword(String username, String uuid, String password);

	Person findPersonByUsername(String username);

	boolean sendResetPasswordEmail(Person p);

	boolean modifyVerifiedEmail(Person p);

	void getMyQrcodeToStream(Person p, OutputStream outputStream) throws IOException;

	Page<SiteMessage> getMyMessages(Person p, boolean isFrom, int page, int length);

	Person getPersonByUsername(String username);

	SiteMessage sendSiteMessage(SiteMessage siteMessage);
}
